<%--
  Created by IntelliJ IDEA.
  User: 林
  Date: 2022-01-06
  Time: 17:18
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <style>
        ul,
        ul li {
            list-style: none;
            margin: 0;
            padding: 0;
        }

        label {
            color: #9c5223;
        }

        .invoicMain {
            width: 920px;
            margin: 0 auto;
            font-size: 14px;
            color: #000;
            padding: 20px;
            border: 3px solid #000;
        }

        .invoiceHeader {
            height: 126px;
            display: flex;
            /* justify-content: space-between; */
            align-items: center;
        }

        .headerLeft li:nth-child(1) {
            text-indent: 1em;
        }

        .headerLeft li img {
            width: 105px;
            height: 105px;

        }

        .headerMiddle h1 {
            font-size: 32px;
            color: #9c5223;
            font-family: 'kaiti';
            margin: 5px 12px;
        }

        .line {
            height: 2px;
            border-top: #9c5223 1px solid;
            border-bottom: #9c5223 1px solid;
        }

        .headerRight li {
            line-height: 24px;
        }

        .invoiceBody {
            border: 1px solid #9c5223;
        }

        .userInfo {
            width: 100%;
            display: flex;
            align-items: center;
            height: 96px;
            border-bottom: 1px solid #9c5223;
        }

        .userInfo ul {
            width: 50%;
            margin: 0 5px;
            padding: 0;

        }

        .userInfo ul li {
            line-height: 24px;
        }

        .buy {
            width: 20px;
            border-right: 1px solid #9c5223;
            padding: 0 1px;
            text-align: center;
            height: 100%;
            display: flex;
            align-items: center;
            color: #9c5223;
        }

        .password {
            width: 20px;
            padding: 0 1px;
            border-right: 1px solid #9c5223;
            border-left: 1px solid #9c5223;
            text-align: center;
            height: 100%;
            display: flex;
            align-items: center;
            color: #9c5223;
        }

        .pwdInfo {
            flex: 1;
            padding-left: 5px;
        }

        .goodsInfo {
            height: 210px;
            margin: 0;
            padding: 0;

        }

        .goodsInfo li {
            display: flex;
            color: #9c5223;
            text-align: center;
        }

        .name {
            width: 260px;
            border-right: 1px solid #9c5223;
        }

        .spec {
            width: 140px;
            border-right: 1px solid #9c5223;
        }

        .qty {
            width: 108px;
            border-right: 1px solid #9c5223;
        }

        .unit,
        .taxRate {
            width: 65px;
            border-right: 1px solid #9c5223;
        }

        .qty,
        .price {
            width: 160px;
            border-right: 1px solid #9c5223;
        }

        .money {
            flex: 1;
            border-right: 1px solid #9c5223;
        }

        .taxAmount {
            flex: 1;
        }

        .GoodsTable {
            height: 210px;
            width: 100%;
            border-collapse: collapse;
        }

        .GoodsTable .invoice-list {
            /* height: 24px; */
        }

        .GoodsTable td {
            border-right: 1px solid #9c5223;
            color: #9c5223;
        }

        .GoodsTable tr:nth-child(1),
        .GoodsTable tr:nth-last-child(2) {
            height: 24px;
        }

        .GoodsTable tr:nth-last-child(1) {
            height: 34px;
        }

        .GoodsTable tr:nth-child(1) td {
            text-align: center;
        }

        .GoodsTotal {
            border-top: 1px solid #9c5223;
            border-bottom: 1px solid #9c5223;
        }

        .total td:nth-child(1) {
            text-align: center;
        }

        .invoicetFooter {
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: space-between;
        }

        .invoicetFooter li {
            width: 25%;
        }
        .invoiceHeader-left{
            width: 67%;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        .headerRight{
            margin-left: 28px;
        }
        .headerMiddle{
            margin-right: 15px;
            position: relative;
            right: 50px;
        }
        .modal-content {
            width: 1000px;
            position: relative;
            left: -230px;
        }
    </style>
</head>
<body>
<table id="tableqaq">

</table>
<div class="modal fade" id="edituserwinn">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
            </div>
            <div class="invoicMain">
                <!-- head start -->
                <div class="invoiceHeader">
                    <div class="invoiceHeader-left">
                        <ul class="headerLeft">

                        </ul>
                        <div class="headerMiddle">
                            <h1>审核详情单</h1>
                            <div class="line"></div>
                        </div>
                    </div>

                    <ul class="headerRight">
                        <li>
                            <label> 审核日期： </label><span id="qwq"></span>
                        </li>
                    </ul>
                </div>
                <!-- head end -->
                <!-- invoice body start -->
                <div class="invoiceBody">
                    <div class="userInfo">
                        <div class="buy">产品信息</div>
                        <ul>
                            <li>
                                <label>产品名称:</label><span  id="productname"></span>
                            </li>
                            <li>
                                <label>制造商：</label><span  id="factoryname"></span>
                            </li>
                            <li>
                                <label>产品简称：</label><span  id="productnick"></span>
                            </li>
                            <li>
                                <label>建档时间：</label><span  id="registertime"></span>
                            </li>
                        </ul>
                        <div class="password">设计人</div>
                        <div class="pwdInfo"></div>
                    </div>
                    <div>
                        <table class="GoodsTable" cellpadding="0" cellspacing="0">
                            <tr>
                                <td style="width: 24%" >生产计划编号</td>
                                <td style="width: 10%" >产品编号</td>
                                <td style="width: 7%" >用途类型</td>
                                <td style="width: 10%" >数量</td>
                                <td style="width: 10%" >审核意见</td>
                                <td style="width: 16%" >备注</td>
                                <td style="width: 7%" >测试类</td>
                                <td style="width: 16%; border-right: none;" >审核时间</td>
                            </tr>
                            <tr class="invoice-list">
                                <td id="applyid"></td>
                                <td id="productid"></td>
                                <td id="type"></td>
                                <td id="amount"></td>
                                <td id="checksuggestion"></td>
                                <td id="remark"></td>
                                <td>test</td>
                                <td id="checktime"></td>
                            </tr>

                            <tr class="total">
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                            </tr>
                            <tr class="GoodsTotal">
                                <td>出库人</td>
                                <td colspan="7">
                                    <div style="width: 100%;display:flex">
                                        <div type="text" style="width: 60%" ><span id="storer"></span></div>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
              </div>
           </div>
        </div>
    </div>
</div>
<script>
    var paramss={
        url:"${pageContext.request.contextPath}/pdpatch.action",
        method: 'GET',                      //请求方式（*）
        toolbar: '#toolbar',              //工具按钮用哪个容器
        striped: true,                      //是否显示行间隔色
        cache: false,                       //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
        pagination: true,                   //是否显示分页（*）
        sortable: true,                     //是否启用排序
        sortOrder: "asc",                   //排序方式
        sidePagination: "server",           //分页方式：client客户端分页，server服务端分页（*）
        pageNumber: 1,                      //初始化加载第一页，默认第一页,并记录
        pageSize: 5,                     //每页的记录行数（*）
        pageList: [5, 10, 25, 50, 100],        //可供选择的每页的行数（*）
        search: false,                      //是否显示表格搜索
        strictSearch: true,
        showColumns: true,                  //是否显示所有的列（选择显示的列）
        showRefresh: true,                  //是否显示刷新按钮
        minimumCountColumns: 2,             //最少允许的列数
        clickToSelect: true,                //是否启用点击选中行
        height: 500,                      //行高，如果没有设置height属性，表格自动根据记录条数觉得表格高度
        uniqueId: "id",                     //每一行的唯一标识，一般为主键列
        showToggle: true,                   //是否显示详细视图和列表视图的切换按钮
        cardView: false,                    //是否显示详细视图
        detailView: false,                  //是否显示父子表
        queryParams: function (params) {
            //这里的键的名字和控制器的变量名必须一直，这边改动，控制器也需要改成一样的
            var temp = {
                pagesize: params.limit,                         //页面大小
                pageno: (params.offset / params.limit) + 1,   //页码
                productName: $("#productName").val()  //查询条件
            };
            return temp;
        },
        columns:[
            {
                title:"计划单编号",
                field:"applyId"
            },
            {
                title:"产品单编号",
                field:"productId"
            },
            {
                title:"产品名称",
                field:"productName"
            },
            {
                title:"描述",
                field:"productDescribe"
            },
            {
                title:"数量",
                field:"amount"
            },
            {
                title:"出库单编号集合",
                field:"payId",
                formatter:function (value){
                    if(value==null){
                        return "暂无数据"
                    }
                }
            },
            {
                title:"审核时间",
                field:"checkTime"
            },

            {
                title:"操作",
                field: "",
                formatter:function (value, row, index) {
                    return "<input type='button' value='审核通过' class='btn btn-success' onclick='tg("+row.applyId+")'>"+"&nbsp;"
                        +"<input type='button' value='审核不通过' class='btn btn-success' onclick='dy("+row.applyId+")'>"+"&nbsp;"
                        +"<input type='button' value='查看详细' class='btn btn-success' onclick='ckqaq("+row.applyId+")'>"+"&nbsp;";
                }
            }
        ]};
    $("#tableqaq").bootstrapTable(paramss)

    //预览
    function ckqaq(applyId){
        $.ajax({
            url:'${pageContext.request.contextPath}/pdpatch.action/'+applyId+'',
            type:"get",
            dataType:"json",
            success:function (data){
                console.log($("#productname"))
                $("#productname").text(data.productName)
                $("#factoryname").text(data.factoryName)
                $("#productnick").text(data.productNick)
                $("#registertime").text(data.registerTime)
                $(".pwdInfo").text(data.designer)
                $("#applyid").text(data.applyId)
                $("#productid").text(data.productId)
                $("#type").text(data.type)
                $("#amount").text(data.amount)
                $("#checksuggestion").text(data.checkSuggestion)
                $("#remark").text(data.remark)
                $("#checktime").text(data.checkTime)
                $("#storer").text(data.storer)
            }
        })
        $("#edituserwinn").modal("show");
    }

        //时间
    function init(){
        var date=new Date();
        //年
        var year=date.getFullYear();
        //月
        var month=date.getMonth()+1;
        //日
        var day=date.getDate();
        //时
        var hh=date.getHours();
        //分
        var mm=date.getMinutes();
        //秒
        var ss=date.getSeconds();
        var rq=year+"年"+month+"月"+day+"日"+hh+":"+mm+":"+ss;
        document.getElementById("qwq").innerHTML=rq
        console.log(rq)
    }
    init()

    function tg(applyId){
        // alert(applyId)
        if(confirm("确定通过吗")){
            $.ajax({
                url:'${pageContext.request.contextPath}/pdpatch.action/'+applyId+'',
                type:"put",
                dataType: "json",
                success:function (data){
                    if(data.code=="1"){
                        $("#tableqaq").bootstrapTable("refresh");
                        alert("审核成功")
                    }
                }
            })
        }
    }
</script>
</body>
</html>
